//
//  WYStoreModule.m
//  JJEW_COMPANY
//
//  Created by 曹运 on 2017/3/16.
//  Copyright © 2017年 admin. All rights reserved.
//

#import "WYStoreModule.h"

@implementation WYStoreModule
+ (void)storeToken:(NSString *)token {
    
    [[NSUserDefaults standardUserDefaults] setObject:token forKey:@"FY_TOKEN"];
    [[NSUserDefaults standardUserDefaults] synchronize];
}
/**
 *  获取当前Token
 */
+ (NSString *)currentToken {
    
    NSString *token  = [[NSUserDefaults standardUserDefaults] objectForKey:@"FY_TOKEN"];
    return (token == nil)?@"":token;
}
/**
 *  清除存储
 */
+ (void)cleanToken {
    
    [[NSUserDefaults standardUserDefaults] removeObjectForKey:@"FY_TOKEN"];
    [[NSUserDefaults standardUserDefaults] synchronize];
}
+(void)storeUserSize:(NSString *)size
{
    [[NSUserDefaults standardUserDefaults] setObject:size forKey:@"userSize"];
    [[NSUserDefaults standardUserDefaults] synchronize];
}
+(BOOL)isUserSize
{
    NSString *token  = [[NSUserDefaults standardUserDefaults] objectForKey:@"userSize"];
    if (token.length) {
        return YES;
    }else{
        return NO;
    }
}
+(void)clearSize
{
    [[NSUserDefaults standardUserDefaults] removeObjectForKey:@"userSize"];
    [[NSUserDefaults standardUserDefaults] synchronize];
}

+(void)storeUserName:(NSString *)name
{
    [[NSUserDefaults standardUserDefaults] setObject:name forKey:@"username"];
    [[NSUserDefaults standardUserDefaults] synchronize];
}
+(NSString *)currentName
{
    NSString *name  = [[NSUserDefaults standardUserDefaults] objectForKey:@"username"];
    return (name == nil)?@"":name;
}
+(void)stroeUserInfo:(WYUserInfo *)userInfo
{
    [[NSUserDefaults standardUserDefaults] setObject:userInfo.mj_keyValues forKey:@"FY_USERMESSAGE"];
    [[NSUserDefaults standardUserDefaults] synchronize];
}
+(WYUserInfo *)currentUserInfo
{
    NSDictionary *parm = [[NSUserDefaults standardUserDefaults] objectForKey:@"FY_USERMESSAGE"];
    
    //    WYUserMessage *userMessage =( WYUserMessage *) [NSKeyedUnarchiver unarchiveObjectWithData:data];
    return [WYUserInfo getUserInfoFromJson:parm];
}




@end
